package com.hu.mapper;

import com.hu.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper

public interface EmpMapper {


    /**查询总记录数
     * @return
     */
    @Select("select count(*) from tlias.emp")
    public Long count();

    /**分页条件查询
     * @param name
     * @param gender
     * @param begin
     * @param end
     * @return
     */
    public List<Emp> list(String name, Short gender, LocalDate begin, LocalDate end);

    /**批量删除
     * @param ids
     */
    void delete(List<Integer> ids);


    /**新增员工
     * @param emp
     */
    @Insert("insert into tlias.emp(username, name, gender, image, job, entrydate, dept_id, create_time, update_time) " +
            "values(#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime})")
    void insert(Emp emp);


    /**根据Id查询信息
     * @param id
     * @return
     */
    @Select("select * from tlias.emp where id = #{id}")
    Emp getByID(Integer id);

    /**修改员工数据
     *
     */
    void update(Emp emp);
}
